package com.liner;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * 学生类的测试类
 */
public class StudentTest {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        Student student1 = new Student();





        Student student2 = new Student("张三", 18, "一年级", "9527");
        Student student3 = new Student();


        ArrayList<Student> students1 = new ArrayList<>();
        for (int i = 1; i < 10; i++) {

            System.out.println("请输入第" + i+ "位同学的信息:");
            System.out.print("请输入学生姓名:");
            String name = scanner.next();
            System.out.print("请输入学生年龄:");
            int age = scanner.nextInt();
            System.out.print("请输入学生学号:");
            String stuId = scanner.next();
            System.out.print("请输入学生班级编号:");
            String className = scanner.next();
            Student student = new Student(name, age, className, stuId);
            students1.add(student);
        }
        for (Student student : students1) {
            System.out.println(student);
        }



        student1.name = "李四";
        student1.age = 21;
        student1.className = "二年级";
        student1.stuId = "9522";
        student1.study();
        student2.study();

        student3.study();


        ArrayList<Student> students = new ArrayList<>();
        for (int i = 1; i <= 3; i++) {
            Student student = new Student();
            student.setAge(i);
            student.setStuId("00" + i);
            System.out.print("输入第" + i + "学生姓名:");
            student.setName(scanner.next());
            student.setClassName(i + "年级");
            students.add(student);
        }

        for (Student student : students) {
            System.out.println(student);
        }


    }
}
